package andrew2;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Vector;

import javax.swing.JTextArea;

public class StreamingClient implements Runnable{

	/**
	 * The client host name.
	 */
	public String my_serverHost;

	/**
	 * The client port.
	 */
	public int my_serverPort;

	/**
	 * Sets the client up with the server details.
	 * 
	 * @param the_serverHost
	 *            the server host name.
	 * @param the_serverPort
	 *            the server port.
	 */

	public StreamingClient(final String the_serverHost, final int the_serverPort) {
		my_serverHost = the_serverHost;
		my_serverPort = the_serverPort;
	}

	@Override
	public void run() {
		try {
			// Create a connection to the server.
			final Socket toServer = new Socket(my_serverHost, my_serverPort);
			final BufferedReader in = new BufferedReader(new InputStreamReader(toServer.getInputStream()));
			final PrintWriter out = new PrintWriter(toServer.getOutputStream(), true);
			out.println("hello");
			System.out.println(in.readLine());
		} catch (final IOException ioe) {
			ioe.printStackTrace();
		} catch (final SecurityException se) {
			se.printStackTrace();
		}
		
	}

} // end class

